//
//  WYWWeatherView.m
//  SpiritWalk
//
//  Created by 王鑫 on 16/3/21.
//  Copyright © 2016年 王鑫. All rights reserved.
//

#import "WYWWeatherView.h"

@implementation WYWWeatherView

-(instancetype)initWithFrame:(CGRect)frame{
    self=[super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}
-(void)createView{
    self.tmpLabel =[[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, 100) ];
    self.tmpLabel.textAlignment=NSTextAlignmentCenter;
    self.tmpLabel.textColor=[UIColor whiteColor];
    self.tmpLabel.font=[UIFont fontWithName:@"AmericanTypewriter-Light" size:90.f];
    [self addSubview:self.tmpLabel];
    self.tmpLabel.backgroundColor=[UIColor clearColor];
    
    self.txtLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, self.tmpLabel.frame.size.height, self.frame.size.width, 35)];
    self.txtLabel.textAlignment=NSTextAlignmentCenter;
    self.txtLabel.textColor=[UIColor whiteColor];
    self.txtLabel.backgroundColor=[UIColor clearColor];
    self.txtLabel.font=[UIFont systemFontOfSize:25];
    [self addSubview:self.txtLabel];
    //-----------------------------------------------------
    self.dirLabelLeft=[UILabel new];
    self.dirLabelLeft.text=@"风力";
    [self addSubview:self.dirLabelLeft];
    [self.dirLabelLeft mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.txtLabel.mas_bottom);
        make.left.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.dirLabelLeft.textColor=[UIColor whiteColor];
    self.dirLabelLeft.backgroundColor=[UIColor clearColor];
    
    self.dirLabelRight=[UILabel new];
    self.dirLabelRight.textAlignment=NSTextAlignmentRight;;
    [self addSubview:self.dirLabelRight];
    [self.dirLabelRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.txtLabel.mas_bottom);
        make.left.mas_equalTo(self.dirLabelLeft.mas_right);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.dirLabelRight.textColor=[UIColor whiteColor];
    self.dirLabelRight.backgroundColor=[UIColor clearColor];
    
    self.lineLabel=[UILabel new];
    self.lineLabel.backgroundColor=[UIColor whiteColor];
    [self addSubview:self.lineLabel];
    [self.lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width, 0.5));
        make.left.mas_equalTo(self);
        make.top.mas_equalTo(self.dirLabelRight.mas_bottom);
    }];
    //------------------------------------------------------------
    self.pm25LabelLeft=[UILabel new];
    self.pm25LabelLeft.text=@"pm25";
    [self addSubview:self.pm25LabelLeft];
    [self.pm25LabelLeft mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.dirLabelRight.mas_bottom);
        make.left.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
      self.pm25LabelLeft.textColor=[UIColor whiteColor];
      self.pm25LabelLeft.backgroundColor=[UIColor clearColor];
    
    self.pm25LabelRight=[UILabel new];
    self.pm25LabelRight.textAlignment=NSTextAlignmentRight;;
    [self addSubview:self.pm25LabelRight];
    [self.pm25LabelRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.dirLabelRight.mas_bottom);
        make.left.mas_equalTo(self.pm25LabelLeft.mas_right);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.pm25LabelRight.textColor=[UIColor whiteColor];
    self.pm25LabelRight.backgroundColor=[UIColor clearColor];
    
    self.lineLabel=[UILabel new];
    self.lineLabel.backgroundColor=[UIColor whiteColor];
    [self addSubview:self.lineLabel];
    [self.lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width, 0.5));
        make.left.mas_equalTo(self);
        make.top.mas_equalTo(self.pm25LabelLeft.mas_bottom);
    }];
    //------------------------------------------------------------
    self.pm10LabelLeft=[UILabel new];
    self.pm10LabelLeft.text=@"pm10";
    [self addSubview:self.pm10LabelLeft];
    [self.pm10LabelLeft mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.pm25LabelLeft.mas_bottom).offset(1);
        make.left.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.pm10LabelLeft.textColor=[UIColor whiteColor];
    self.pm10LabelLeft.backgroundColor=[UIColor clearColor];
    
    self.pm10LabelRight=[UILabel new];
    self.pm10LabelRight.textAlignment=NSTextAlignmentRight;
    [self addSubview:self.pm10LabelRight];
    [self.pm10LabelRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.pm25LabelLeft.mas_bottom);
        make.left.mas_equalTo(self.pm10LabelLeft.mas_right);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.pm10LabelRight.textColor=[UIColor whiteColor];
    self.pm10LabelRight.backgroundColor=[UIColor clearColor];
    
    self.lineLabel=[UILabel new];
    self.lineLabel.backgroundColor=[UIColor whiteColor];
    [self addSubview:self.lineLabel];
    [self.lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width, 0.5));
        make.left.mas_equalTo(self);
        make.top.mas_equalTo(self.pm10LabelLeft.mas_bottom);
    }];
 //------------------------------------------------------------------
    self.qltyLabelLeft=[UILabel new];
    self.qltyLabelLeft.text=@"空气质量";
    [self addSubview:self.qltyLabelLeft];
    [self.qltyLabelLeft mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.pm10LabelLeft.mas_bottom).offset(1);
        make.left.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.qltyLabelLeft.textColor=[UIColor whiteColor];
    self.qltyLabelLeft.backgroundColor=[UIColor clearColor];
    
    self.qltyLabelRight=[UILabel new];
    self.qltyLabelRight.textAlignment=NSTextAlignmentRight;
    [self addSubview:self.qltyLabelRight];
    [self.qltyLabelRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.pm10LabelLeft.mas_bottom);
        make.left.mas_equalTo(self.qltyLabelLeft.mas_right);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.qltyLabelRight.textColor=[UIColor whiteColor];
    self.qltyLabelRight.backgroundColor=[UIColor clearColor];
    
    self.lineLabel=[UILabel new];
    self.lineLabel.backgroundColor=[UIColor whiteColor];
    [self addSubview:self.lineLabel];
    [self.lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width, 0.5));
        make.left.mas_equalTo(self);
        make.top.mas_equalTo(self.qltyLabelLeft.mas_bottom);
    }];
    //-----------------------------------------------------------------
    self.humLabelLeft=[UILabel new];
    self.humLabelLeft.text=@"湿度";
    [self addSubview:self.humLabelLeft];
    [self.humLabelLeft mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.qltyLabelLeft.mas_bottom).offset(1);
        make.left.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.humLabelLeft.textColor=[UIColor whiteColor];
    self.humLabelLeft.backgroundColor=[UIColor clearColor];
    
    self.humLabelRight=[UILabel new];
    self.humLabelRight.textAlignment=NSTextAlignmentRight;
    [self addSubview:self.humLabelRight];
    [self.humLabelRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.qltyLabelLeft.mas_bottom);
        make.left.mas_equalTo(self.humLabelLeft.mas_right);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.humLabelRight.textColor=[UIColor whiteColor];
    self.humLabelRight.backgroundColor=[UIColor clearColor];
    
    self.lineLabel=[UILabel new];
    self.lineLabel.backgroundColor=[UIColor whiteColor];
    [self addSubview:self.lineLabel];
    [self.lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width, 0.5));
        make.left.mas_equalTo(self);
        make.top.mas_equalTo(self.humLabelLeft.mas_bottom);
    }];
    //--------------------------------------------------------------------------------
    self.presLabelLeft=[UILabel new];
    self.presLabelLeft.text=@"气压";
    [self addSubview:self.presLabelLeft];
    [self.presLabelLeft mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.humLabelLeft.mas_bottom).offset(1);
        make.left.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.presLabelLeft.textColor=[UIColor whiteColor];
    self.presLabelLeft.backgroundColor=[UIColor clearColor];
    
    self.presLabelRight=[UILabel new];
    self.presLabelRight.textAlignment=NSTextAlignmentRight;
    [self addSubview:self.presLabelRight];
    [self.presLabelRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.humLabelLeft.mas_bottom);
        make.left.mas_equalTo(self.presLabelLeft.mas_right);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width/2, 35));
    }];
    self.presLabelRight.textColor=[UIColor whiteColor];
    self.presLabelRight.backgroundColor=[UIColor clearColor];
    
    self.lineLabel=[UILabel new];
    self.lineLabel.backgroundColor=[UIColor whiteColor];
    [self addSubview:self.lineLabel];
    [self.lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width, 0.5));
        make.left.mas_equalTo(self);
        make.top.mas_equalTo(self.presLabelRight.mas_bottom);
    }];
    //-------------------------------------------------------------------
    self.promptLabel=[UILabel new];
    self.promptLabel.text=@"温馨提示";
    self.promptLabel.textAlignment=NSTextAlignmentCenter;
    self.promptLabel.textColor=[UIColor grayColor];
    self.promptLabel.font=[UIFont systemFontOfSize:13];
    self.promptLabel.backgroundColor=[UIColor clearColor];
    [self addSubview:self.promptLabel];
    [self.promptLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.presLabelLeft.mas_bottom).offset(4);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width, 30));
        make.left.mas_equalTo(self);
    }];
    
    self.comfLabel=[UILabel new];
    self.comfLabel.textColor=[UIColor grayColor];
    self.comfLabel.font=[UIFont systemFontOfSize:15];
    self.comfLabel.backgroundColor=[UIColor clearColor];
    self.comfLabel.numberOfLines=0;
    [self addSubview:self.comfLabel];
    [self.comfLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.promptLabel.mas_bottom).offset(2);
        make.width.mas_equalTo(self.frame.size.width);
        make.left.mas_equalTo(self);
    }];
}
@end
